{{! template-lint-disable }}
{{!-- template lint is running into a strange non-templating error on this file. Temporary measure --}}
<form {{action "onUpdateDeprecation" on="submit"}}>

  <div class="entity-deprecation__toggle-header">
    <p class="entity-deprecation__toggle-header__label">
      Is this {{entityName}} deprecated?
    </p>
    {{input
      id=(concat entityName "-is-deprecated")
      type="checkbox"
      title=(concat "Is this " entityName " deprecated?")
      class="toggle-switch toggle-switch--light"
      checked=(readonly isDeprecatedAlias)
      change=(action "toggleDeprecatedStatus")
    }}
    <label for="{{entityName}}-is-deprecated" class="toggle-button">
    </label>
  </div>

  {{#if isDeprecatedAlias}}

    <MediumEditor
      class="entity-deprecation__note-editor"
      @value={{deprecationNoteAlias}}
      @options={{editorOptions}}
      @onInput={{action (mut deprecationNoteAlias)}} />

    <h4 class="dataset-deprecation__header">When should this {{entityName}} be decommissioned?</h4>

    {{#basic-dropdown as |dropdown|}}
      <input
        type="text"
        placeholder="Enter Date"
        data-ebd-id="{{dropdown.uniqueId}}-trigger"
        class="entity-deprecation__cal-input-trigger"
        value={{if decommissionTime (moment-format decommissionTime 'DD-MMM-YYYY')}}
        onclick={{dropdown.actions.toggle}}
        readonly>

      {{#dropdown.content class="entity-deprecation__cal-dropdown"}}
        <PowerCalendar
          class="entity-deprecation__decommission-calendar"
          @selected={{selectedDate}}
          @center={{centeredDate}}
          @onSelect={{action "onDecommissionDateChange" value="date"}}
          @onCenterChange={{action (mut centeredDate) value="date"}} as |calendar|>

          <nav class="ember-power-calendar-nav">

            <button
              type="button"
              class="ember-power-calendar-nav-control"
              onclick={{action calendar.actions.moveCenter -1 'month'}}>
              &lt;
            </button>
            <div class="ember-power-calendar-nav-title">
              {{moment-format calendar.center 'MMMM YYYY'}}
            </div>
            <button
              type="button"
              class="ember-power-calendar-nav-control"
              onclick={{action calendar.actions.moveCenter 1 'month'}}>
              &gt;
            </button>
          </nav>

          <calendar.Days @minDate={{minSelectableDecommissionDate}}/>

        </PowerCalendar>
      {{/dropdown.content}}
    {{/basic-dropdown}}

    <p class="entity-decommission-date {{unless decommissionTime 'entity-decommission-date--required'}}">
      {{#unless decommissionTime}}
        Please specify a date when this {{entityName}} will be decommissioned
      {{/unless}}

      <strong>
        {{if decommissionTime (concat 'Will be decommissioned on ' (moment-format decommissionTime 'MMMM DD YYYY')) ''}}
      </strong>
    </p>
  {{/if}}

  <div class="entity-deprecation__actions">
    <button
      type="submit"
      class="nacho-button--large nacho-button--secondary"
      disabled={{and isDeprecatedAlias (not decommissionTime)}}>
      Update Deprecation Status
    </button>
  </div>

</form>

{{yield}}